<template>
    <div class="box">
        <input type="text" class="input" v-model="content" placeholder="请输入新任务" @keyup.enter="addHandler">
        <button class="button" @click="addHandler">添加任务</button>
    </div>
</template>

<script>
    export default{
        data(){
            return{
                content:""
            }
        },
        methods:{
            addHandler(){
                this.$emit("add",this.content)
                this.content = ""
            }
        }
    }
</script>

<style scoped>
.box{
    width: 100%;
    height: 40px;
    border: 2px solid #be5758;
    margin: auto;
    border-radius: 13px;
    display: flex;
}
.input{
    border-radius: 13px 0 0 13px;
    flex-grow: 9;
    height: 38px;
    outline: none;
    border: none;
}
.button{
    border-radius: 0 8px 8px 0;
    flex-grow: 1;
    height: 40px;
    color: white;
    background-color: #be5758;
    outline: none;
    border: none;
}
</style>